
template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; } 

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Button.h>

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args)  write(args);
#else
#define printByte(args)  print(args,BYTE);
#endif

Button button = Button(5,PULLUP);

LiquidCrystal_I2C lcd(0x20,16,2);  // set the LCD address to 0x3f for a 16 chars and 2 line display
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0}; //Custom Char Haert

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.createChar(1, heart);
  /*for(int i=0;i<256;i++){
    while(button.isPressed()){};
    lcd.clear();
    lcd.print(i);lcd.setCursor(0,1);
    lcd.write(byte(i));
    while(!button.isPressed()){};
  }*/
  //225 : ä;239 :ö;245:ü
}

void schreibUndWart(char* txt, boolean mitpfeil = false){
  lcd.setCursor(0,1);
  lcd << txt; 
  delay(500);
  if(mitpfeil){lcd.write(byte(126));} 
  while(!button.isPressed()){};
  while(button.isPressed()){};
}

void loop()
{
  lcd.clear();
  lcd << "Zum starten";lcd.setCursor(0,1);
  lcd << "  Knopf dr";lcd.write(byte(245));lcd<<"cken";lcd.write(byte(126)); 
  delay(500);
  while(!button.isPressed()){};
  while(button.isPressed()){};
  
  lcd.clear();
  lcd<<"  meine S";lcd.write(byte(245));lcd<<"sse,";
  schreibUndWart("zu deinem B-Day", true);
  
  lcd.clear();
  lcd<<"w";lcd.write(byte(245));lcd<<"nsche ich dir";
  schreibUndWart("Alles Liebe und", true);  
  
  lcd.clear();
  lcd<<"erdenklich Gute!";
  schreibUndWart("", true);
  
  lcd.clear();
  lcd<<"Du bist ein wund";
  schreibUndWart("ervoller Mensch", true);

  lcd.clear();
  lcd<<"und ich liebe ";
  lcd.setCursor(0,1);
  lcd << "DICH "; lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(1));lcd.write(byte(126)); 
  delay(500);
  while(!button.isPressed()){};
  while(button.isPressed()){};
  
  lcd.clear();
  lcd<<"Happy Bithday!!!";
  lcd.setCursor(0,1);
  lcd<<"* * * * * * * * *";
  for(int i=0;i<13;i++){
    lcd.noBacklight();
    delay(200);
    lcd.backlight();
    delay(200);
  }
  playBirthdaySong();
  
  lcd.clear();
  lcd<<"von deinem ";lcd.setCursor(0,1);
  lcd<<"        T";lcd.write(byte(245));lcd<<"fftler";
  playBirthdaySong();
  delay(20000);
  
}
